package com.seek.constants;

import org.apache.commons.lang.StringUtils;

/**
 * 运营商枚举
 * Created by weh on 2017/7/8.
 */
public enum CarrierEnum {

  CHINA_MOBILE("CHINA_MOBILE", "中国移动"),
  CHINA_TELECOM("CHINA_TELECOM", "中国电信"),
  CHINA_UNICOM("CHINA_UNICOM", "中国联通");

  private String code;
  private String name;

  private CarrierEnum(String code, String name) {
    this.code = code;
    this.name = name;
  }

  public static CarrierEnum getCarrierByCode(String code) {

    for (CarrierEnum carrierEnum : CarrierEnum.values()) {
      if (StringUtils.equals(code, carrierEnum.getCode())) {
        return carrierEnum;
      }
    }
    return null;
  }

  public String getCode() {
    return code;
  }

  public void setCode(String code) {
    this.code = code;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }
}
